#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>

void pr_exit(pid_t pid, int status) {
    if (WIFEXITED(status)) {
        printf("process(%d) normally exited (exit status: %d)\n", pid, WEXITSTATUS(status));
    } else if (WIFSIGNALED(status)) {
        printf("process(%d) abnormally exited (by signal %d)\n", pid, WTERMSIG(status));
    }
}
